package cn.nfwx.tv.util;

import android.content.Context;

import com.umeng.analytics.MobclickAgent;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import cn.nfwx.tv.helper.UmengPushHelper;

/**
 * Created by zb.liu on 2017/12/13.
 */

public class MobAgentUtil {

    /***
     * 友盟统计埋点
     * 不同频道的停留时长
     */
    public static void channelDurations(Context context, String name, long channelBeginTime) {
        Map<String, String> channelmap = new HashMap<String, String>();
        channelmap.put("channelDurations", (System.currentTimeMillis() - channelBeginTime) + "");
        channelmap.put("channel", name);
        channelmap.put("deviceid", UmengPushHelper.getInstance().getDeviceToken());
        MobclickAgent.onEvent(context, "channelDurations");
    }


    /***
     * 友盟统计埋点
     * 裁剪短视频分享到微信
     */
    public static void shortClipWechatClick(Context context) {
        MobclickAgent.onEvent(context, "shortClipWechatClick");
    }

    /***
     * 友盟统计埋点
     * 裁剪短视频分享到朋友圈
     */
    public static void shortClipFriendClick(Context context) {
        MobclickAgent.onEvent(context, "shortClipFriendClick");
    }

    /***
     * 友盟统计埋点
     * 裁剪短视频的下载
     */
    public static void downloadClick(Context context) {
        MobclickAgent.onEvent(context, "downloadClick");
    }

    /**
     * 友盟统计埋点
     * 裁剪按钮的点击
     */
    public static void cutClicked(Context context) {
        MobclickAgent.onEvent(context, "cutClicked");
    }

    /***
     * 友盟统计埋点
     * 裁剪界面的停留时长
     */
    public static void cutDurations(Context context, long cutBeginTime) {
        long cutEndTime = System.currentTimeMillis();
        Map<String, String> map = new HashMap<String, String>();
        map.put("cutDurations", (cutEndTime - cutBeginTime) + "");
        map.put("deviceid", UmengPushHelper.getInstance().getDeviceToken());
        MobclickAgent.onEvent(context, "cutDurations");
    }

    /***
     * 友盟统计埋点
     * 不同频道的点击
     */
    public static void selectedChannel(Context context, String name) {
        Map<String, String> map = new HashMap<String, String>();
        map.put("channel", name);
        map.put("deviceid", UmengPushHelper.getInstance().getDeviceToken());
        MobclickAgent.onEvent(context, "selectedChannel", map);
    }

}
